package top.tsyz.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.tsyz.entity.SystemConfig;
import top.tsyz.service.ISystemConfigService;

import java.util.List;

/**
 * SystemConfigController控制器
 */
@RestController
@RequestMapping("/api/systemConfigs")
@Api(tags = "SystemConfig管理接口")
public class SystemConfigController {

    @Autowired
    private ISystemConfigService isystemconfigservice;

    @GetMapping("/list")
    @ApiOperation("获取所有SystemConfig")
    public List<SystemConfig> list() {
        return isystemconfigservice.list();
    }

    @GetMapping("/{id}")
    @ApiOperation("根据ID获取SystemConfig")
    public SystemConfig getById(@PathVariable Long id) {
        return isystemconfigservice.getById(id);
    }

    @PostMapping
    @ApiOperation("新增SystemConfig")
    public boolean save(@RequestBody SystemConfig systemconfig) {
        return isystemconfigservice.save(systemconfig);
    }

    @PutMapping
    @ApiOperation("更新SystemConfig")
    public boolean update(@RequestBody SystemConfig systemconfig) {
        return isystemconfigservice.updateById(systemconfig);
    }

    @DeleteMapping("/{id}")
    @ApiOperation("删除SystemConfig")
    public boolean delete(@PathVariable Long id) {
        return isystemconfigservice.removeById(id);
    }
}
